package com.wenjie.utils;

import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component;

/**
 * @author wenjie
 * @Description 获取ApplicationContext  -- 从而获取bean对象
 * @date 2024/8/28 10:33
 */
@Component
public class ContextUtils implements ApplicationContextAware {

    private static ApplicationContext context;

    @Override
    public void setApplicationContext(ApplicationContext applicationContext) {
        ContextUtils.context = applicationContext;
    }

    public static ApplicationContext getContext() {
        return context;
    }
}
